<?php


require_once __DIR__.'/../../common/AuthController.php';
use \GatewayWorker\Lib\Gateway;
use app\common\AuthController;


/**
 * 后台首页
 */
class User extends AuthController
{   


    /**
     * 初始化操作
     */
    public function init()
    {




    }
	
    public function register($value='')
    {
        global $db;

        $res = $db->select('Id')->from('user')->where(array('user'=>$data['username']))->row();
        if ($res) {
            //用户已存在
            $this->outMessage($msg['api'],10000,'123',$list);
            return ;
        }

        // 添加用户
        $insert_id = $db->insert('Persons')->cols(array(
        'Firstname'=>'abc',
        'Lastname'=>'efg',
        'Sex'=>'M',
        'Age'=>13))->query();

    }

    /**
     * 后台首页信息
     */
	public function login($msg)
    {   

        
        $user_client = $this->rpc_instance('User');

        $uid = 567;

        $data = $user_client->getInfoByUid($uid);

        var_dump($data);

        $this->outMessage(10000,'ok',$data);


        // global $db;
        // // 匹配账户密码
        // $data = $msg['data'];

        // $list = $db->select('Id')->from('user')->where(array('user'=>$data['username'],'pwd'=>md5($data['password'])))->row();
        // if ($list) {
        //     // 登陆成功

        //     # code...
        // }else{


        //     $this->outMessage($msg['api'],10000,'失败',$list);
        // }

        return ;
	}


}
